// Compress/CopyCoder.h

#ifndef __COMPRESS_COPY_CODER_H
#define __COMPRESS_COPY_CODER_H

#include "Common/COM/ICoder.h"

namespace Common
{
namespace Compress 
{

class ATL_NO_VTABLE CCopyCoder :
  public ICompressCoder,
  public ICompressGetInStreamProcessedSize,
  public CComObjectRootEx<CComSingleThreadModel> 
{
  BYTE *_buffer;
public:
  UINT64 TotalSize;
 
  BEGIN_COM_MAP(CCopyCoder)
	COM_INTERFACE_ENTRY(ICompressCoder)
	COM_INTERFACE_ENTRY(ICompressGetInStreamProcessedSize)		
  END_COM_MAP()



	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		TotalSize = 0;
		_buffer = 0;
		return S_OK;
	}

	void FinalRelease();
	

  STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
      const UINT64 *inSize, const UINT64 *outSize, ICompressProgressInfo *progress);
  STDMETHOD(GetInStreamProcessedSize)(UINT64 *value);
};

HRESULT CopyStream(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);

}}

#endif
